package com.forevershine.business.service.impl;

import java.util.List;

import com.forevershine.business.persistent.EmployeeDao;
import com.forevershine.business.service.AbstractService;
import com.forevershine.personel.model.Employee;

public class EmployeeServiceImpl extends
		AbstractService<Employee, EmployeeDao> {

	
	public void doDaoAction(Employee employee, EmployeeDao daoType,
			Object result) {
		daoType.save(employee, this.mySqlAccessor);
	}

	public void loadAllEmployees(Object result) {
		if (result instanceof List) {
			((List) result).addAll(this.daoModel.load(this.mySqlAccessor));
		}
	}
	
	public void updateEmployee(Employee employee)
	{
		this.daoModel.update(this.mySqlAccessor, employee);
	}
	
	public void addEmployee(Employee employee)
	{
		this.daoModel.add(this.mySqlAccessor, employee);
	}
	
	public void deleteEmployee(Employee employee)
	{
		this.daoModel.delete(this.mySqlAccessor, employee);
	}

}
